#include "texte.hpp"

Texte::Texte(string m)
{
  SDL_Color textColor = { 255, 0, 255 };
  font=TTF_OpenFont("./src/resources/ARCADE.TTF",20);
  texte=TTF_RenderText_Solid(font,m.c_str(),textColor);
  bool=true;
  x=y=0;
}

Texte::Texte(string m,int r,int g,int b)
{
  SDL_Color textColor={r,g,b};
  font=TTF_OpenFont("./resources/ARCADE.TTF",20);
  texte=TTF_RenderText_Solid(font,m.c_str(),textColor);
  bool=true;
  x=y=0;
}

Texte::Texte(string m,string a,int t,int r,int g,int b)
{
  SDL_Color textColor={r,g,b};
  font=TTF_OpenFont(a.c_str(),t);
  texte=TTF_RenderText_Solid(font,m.c_str(),textColor);
  bool=true;
  x=y=0;
}

Texte::Texte(string m,string a,int t,int r,int g,int b,int xp,int yp)
{
  SDL_Color textColor={r,g,b};
  font=TTF_OpenFont(a.c_str(),t);
  texte=TTF_RenderText_Solid(font,m.c_str(),textColor);
  bool=true;
  x=xp;
  y=yp;
}

Texte::~Texte()
{
  if(font)
    delete font;

  if(texte)
    delete texte;
}

SDL_Surface* Texte::get_texte()
{
  return texte;
}

void Texte::afficher_texte(Ecran *e)
{
  if(print)
    e->afficher(x,y,texte);
}
